home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 11369 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.6 KB  |  47 lines

  1. Path: news.citenet.net!g34-84
  2. From: kabir@citenet.net (larry mintz)
  3. Newsgroups: comp.lang.c
  4. Subject: A little more explanation
  5. Date: Sat, 23 Mar 96 13:56:46 GMT
  6. Organization: CiteNet Telecom - Commercial Internet Service
  7. Message-ID: <4j1018$r6i@cti01.citenet.net>
  8. References: <4iskkm$guk@cti01.citenet.net> <4isl5t$guk@cti01.citenet.net>
  9. NNTP-Posting-Host: g34-84.citenet.net
  10. X-Newsreader: News Xpress Version 1.0 Beta #4
  11.  
  12.  
  13. I have the following data in a file called log.dat.It represents the login/out
  14. times of people on a network:  The fields are
  15.                   NAME    LOGIN_TIME  LOGOUT_TIME  PORT
  16. with the following data:
  17.                 
  18.                   urstupid  5:12:12                 67
  19.                   iamsmart  12:34:11     13:23:11   90
  20.                   kthomas   14:23:11     15:12:45   23
  21.                   urstupid   5:30:12     6:00:00    25
  22.  
  23. The structure I am using is 
  24.           struct xx{ char NAME[10];
  25. >                     char LOGIN_TIME[10];
  26.                      char  LOGOUT_TIME[10];
  27.                      unsigned PORT:5;
  28.                    };
  29. struct xx LOGTABLE[10];     
  30.  
  31. Question: How do I load log.dat into the struct LOGTABLE[10] so all the data 
  32. is in the proper fields?
  33.  
  34. What I want is the sructure to look like the following:
  35.  
  36. logtable{{"urstupid","5:12:12","",          67},
  37.          {"iamsmart","12:34:11","13:23:11", 90},
  38.          {"kthomas","3:30:45",   "4:00:00", 23},
  39.          {"urstupid", "5:30:12", "6:00:00"  25}
  40.          };
  41.  
  42. I've tried to read in a structure using fread. It reads in all the data into 
  43. each field ! Help ! What can I do?
  44.  
  45. Kabir.
  46. >kabir.   
  47.